<?php
class Order_Model_OrderReferInfo
{

	private $_table;
	//Initalizing Db Table  
	public function __construct(){
		$this->_table = new Order_Model_DbTable_OrderReferInfo();
	}
	
	public function getAdapter(){
		return $this->_table->getAdapter(); 
	}
	/**
	*Create A Record  
	*@param rowSet 
	*@return boolean
	*/
	public  function add($row){
		$row["ori_create_time"] = date("Y-m-d H:i:s");
 		return $this->_table->insert($row); 
	}

	/**
	*Delete One Row
	*@param int $orders_code 
	*@return boolean
	*/
	public function delete($id){		
		$where = $this->_table->getAdapter()->quoteInto("orders_code= ?", $id);
		return $this->_table->delete($where);
	}
	
	/**
	*Get Rowset  
	*@param string $order_code
	*@return Rowset
	*/
	public function getByOrdersCode($orders_code){
		$where = $this->_table->getAdapter()->quoteInto('orders_code= ?', $orders_code);
		return $this->_table->fetchRow($where);
	}
	
	public function getByfield($field=1,$value=0){
		$where = $this->_table->getAdapter()->quoteInto("{$field} = ?",$value);	
		return $this->_table->fetchAll($where);
	}
	
}